<template>
  <div class="open-questions">
    <!-- 标题 -->
    <div class="header">
      <div class="header__bar"></div>
      <span class="header__text">开放问题</span>
    </div>

    <!-- 横线装饰 -->
    <div class="divider">
      <div class="divider__highlight"></div>
    </div>

    <!-- 主体内容 -->
    <div class="content">
      <!-- 用 el-descriptions 做纯展示，避免 el-form 的冗余语义 -->
      <el-descriptions :column="1" class="info-list">
        <el-descriptions-item label="是否旅游到任何地方？">
          <span class="info-list__text">{{
            personalHabitInfo.hasTravelAnywhere
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="生活信条">
          <span class="info-list__text">{{ personalHabitInfo.lifeMotto }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="最喜欢音乐人">
          <span class="info-list__text">{{
            personalHabitInfo.favoriteMusicArtist
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="在你家里成长是什么感觉">
          <span class="info-list__text">{{
            personalHabitInfo.familyGrowthFeelingA
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="最喜欢的运动">
          <span class="info-list__text">{{
            personalHabitInfo.favoriteSport
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="描述您有什么特殊才能、技能、爱好和兴趣">
          <span class="info-list__text">{{
            personalHabitInfo.specialTalentsSkills
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="您最喜欢的书及原因">
          <span class="info-list__text">{{
            personalHabitInfo.favoriteBooks
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="您最不喜欢什么">
          <span class="info-list__text">{{ personalHabitInfo.dislikes }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="您的人生终极目标和抱负">
          <span class="info-list__text">{{
            personalHabitInfo.lifeGoalAmbition
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="您最喜欢的食物是什么？">
          <span class="info-list__text">{{
            personalHabitInfo.favoriteFood
          }}</span>
        </el-descriptions-item>

        <el-descriptions-item label="您为什么想成为捐卵者">
          <span class="info-list__text">{{
            personalHabitInfo.reasonToBeEggDonor
          }}</span>
        </el-descriptions-item>
      </el-descriptions>
    </div>
  </div>
</template>

<script setup>
import { useUserStore } from "@/store/modules/user";
import { defineProps, onMounted, ref } from "vue";
import { openInfo } from "@/api/business/egg";

const userStore = useUserStore();
const userId = ref("");
const personalHabitInfo = ref({});

const loading = ref(true);

function getList() {
  loading.value = true;
  openInfo({ userId: userId.value }).then((res) => {
    loading.value = false;
    personalHabitInfo.value = res.data;
  });
}

const props = defineProps({
  userId: { type: String, required: true, default: "" },
});

onMounted(() => {
  userId.value = props.userId;
  getList();
});
</script>

<style scoped lang="scss">
/* ===== 设计令牌 ===== */
$font-default: "Microsoft YaHei", "微软雅黑", sans-serif;
$color-text: #333;
$color-border: #a2c4e8;
$color-primary: #2b5cab;

/* ===== 全局基础 ===== */
.open-questions {
  width: 100%;
  font-family: $font-default;
  color: $color-text;
  background-color: #fff; /* 强制白色背景 */
}

/* ===== 标题 ===== */
.header {
  margin-top: 2.133vw;
  display: flex;
  align-items: center;

  &__bar {
    width: 0.3125vw;
    height: 1.354vw;
    background-color: $color-primary;
  }

  &__text {
    margin-left: 0.52vw;
    font-size: 1.25vw;
    color: $color-primary;
  }
}

/* ===== 横线装饰 ===== */
.divider {
  height: 0.052vw;
  background-color: $color-primary;
  margin-top: 0.9375vw;
  position: relative;

  &__highlight {
    width: 23.958vw;
    height: 0.26vw;
    background: linear-gradient(to right, $color-primary, #cedbf0);
    border-radius: 0.104vw;
    position: absolute;
    top: 0;
    left: 0;
  }
}

/* ===== 主体白框 ===== */
.content {
  background-color: #fff; /* 再次确保白色 */
  border: 0.052vw solid $color-border;
  border-radius: 0.416vw;
  margin-top: 1.197vw;
  padding: 1.04vw;
}

/* ===== 描述列表 ===== */
.info-list {
  /* 去掉 el-descriptions 自带加粗 & 多余间距 */
  :deep(.el-descriptions__label) {
    font-weight: normal !important;
    color: $color-text;
  }
  :deep(.el-descriptions__content) {
    color: $color-text;
  }

  /* 答案文字样式 */
  &__text {
    font-size: 0.875rem;
    color: #4d4d4d;
    line-height: 1.6;
  }
}
</style>
